<?php
declare(strict_types=1);

namespace LowCode\Naive;

use LowCode\Naive;
use LowCode\Support\JsExp;
use LowCode\Traits\Props\HasAlign;
use LowCode\Traits\Props\HasInline;
use LowCode\Traits\Props\HasJustify;
use LowCode\Traits\Props\HasSize;
use LowCode\Traits\Props\HasVertical;

/**
 * Flex组件
 * @method static static make(mixed $children = null) Flex组件
 */
class Flex extends Naive
{
    use HasInline, HasAlign, HasJustify, HasSize, HasVertical;

    /**
     * @param mixed|null $children
     */
    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * 设置组件大小尺寸
     * @param string|int|array|JsExp $size 'small' | 'medium' | 'large' | number | [number,number]
     * @return $this
     */
    public function size(string|int|array|JsExp $size = 'small' | 'medium' | 'large'): static
    {
        return $this->prop('size',$size);
    }

    /**
     * 是否超出换行
     * @param bool|JsExp $bool
     * @return $this
     */
    public function wrap(bool|JsExp $bool = true): static
    {
        return $this->prop('wrap', $bool);
    }
}
